/******************************************************************************* 
 * Copyright (c) 2008 xored software, Inc.  
 * 
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0 
 * which accompanies this distribution, and is available at 
 * http://www.eclipse.org/legal/epl-v10.html  
 * 
 * Contributors: 
 *     xored software, Inc. - initial API and Implementation (Yuri Strot) 
 *******************************************************************************/
package com.xored.glance.search;

import com.xored.glance.core.ITextBlock;
import com.xored.glance.search.engine.ISearchUnit;

/**
 * @author Yuri Strot
 * 
 */
public class SearchUnit implements ISearchUnit {

	private ITextBlock container;
	private String text;
	private int offset;

	public SearchUnit(ITextBlock container, int offset) {
		this.container = container;
		this.text = container.getText();
		this.offset = offset;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.xored.glance.search.engine.ITextBlock#getText()
	 */
	public String getText() {
		return text;
	}

	/**
	 * @return the container
	 */
	public ITextBlock getContainer() {
		return container;
	}

	/**
	 * @return the offset
	 */
	public int getOffset() {
		return offset;
	}

	public int getLength() {
		return text.length();
	}

}
